package com.atwisdom.star.dcs.pojo;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value ="RealTimeInfo",autoResultMap = true)
public class RealTimeInfo extends RealTimeBase{
    @TableField(exist = false)
    private static final long serialVersionUID =-1L;
    public final static String START_MARK_QDA = "QDA"; //启动A标识
    public final static String START_MARK_QDB = "QDB"; //启动B标识
    public final static String START_MARK_QD = "QD"; //启动标识
    public final static String STOP_MARK_TZA = "TZA"; //停止A标识
    public final static String STOP_MARK_TZB = "TZB"; //停止B标识
    public final static String START_MARK_TZ = "TZ"; //停止标识
    public final static String PF_MARK = "PF";  //品番标识
    public final static String JS_MARK = "JS"; //计数标识

    //是否异常报警 true 报警，false 没有报警
    @TableField(value = "alarm")
    private boolean alarm;

    /**
     * 检查是否为启停字段
     * @param name 名称
     * @return 如果是报警字段 返回true,否则返回false
     */
    public static boolean checkStart(String name){
        if(name.contains(RealTimeInfo.START_MARK_QDA)){
            return true;
        }else if(name.contains(RealTimeInfo.START_MARK_QDB)){
            return true;
        }else if(name.contains(RealTimeInfo.START_MARK_QD)){
            return true;
        }else{
            return false;
        }
    }

    /**
     * 检查是否为启停字段
     * @param name 名称
     * @return 如果是报警字段 返回true,否则返回false
     */
    public static boolean checkStop(String name){
         if(name.contains(RealTimeInfo.STOP_MARK_TZA)){
            return true;
        }else if(name.contains(RealTimeInfo.STOP_MARK_TZB)){
            return true;
        }else if(name.contains(RealTimeInfo.START_MARK_TZ)){
            return true;
        }else{
            return false;
        }
    }
}